package com.xiaotu.controller;

import cn.hutool.core.lang.Validator;
import cn.hutool.core.util.ObjectUtil;
import com.xiaotu.service.BattlePlayerInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author zhangxiao
 * @create 2022-04-01 15:22
 */
@CrossOrigin
@RestController
@RequestMapping("battlePlayerInfo")
public class BattlePlayerInfoController {

    @Autowired
    private BattlePlayerInfoService battlePlayerInfoService;

    /**
     * 获取对战中玩家信息
     *
     * @param roomId
     * @return
     */
    @GetMapping("getBattlePlayerInfo")
    public Object getBattlePlayerInfo(Integer roomId) {
        Validator.validateTrue(ObjectUtil.isNotNull(roomId), "roomId 不能为空");
        return battlePlayerInfoService.getBattlePlayerInfo(roomId);
    }

}
